package cn.com.tuns.assess.qsb.frame.util;

import android.content.Context;
import android.content.SharedPreferences;
import cn.com.tuns.assess.qsb.frame.ui.MyApplication;

public class SharedPreferencesUtil {
    private  final  static String Name="tuns_save";

    public final static String AdressKey="GdAdress";
    public final static String UserNameKey="UserName";

    public final static String TestWebUrl="TestWebUrl";

    public static void save(String key, String value){
        save(MyApplication.context,key,value);
    }

    public static void save(Context context, String key, String value){
        SharedPreferences preferences = context.getSharedPreferences( Name, Context.MODE_PRIVATE );
        SharedPreferences.Editor editor = preferences.edit();//获取编辑器

        editor.putString(key, value);
        editor.commit();//提交修改
    }

    public static String read(String key)
    {
        return read(MyApplication.context,key);
    }

    public static String read(Context context,String key)
    {
        SharedPreferences preferences = context.getSharedPreferences( Name, Context.MODE_PRIVATE );
        return preferences.getString(key, "");
    }
}
